package com.example.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import com.example.domain.entity.Emp;
import com.example.domain.entity.Params;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;


import java.util.List;

@Repository
public interface EmpMapper extends BaseMapper<Emp> {

    List<Emp> findBySearch(@Param("params") Params params);

    @Select("select * from emp where username = #{username} limit 1")
    Emp findByUserName(@Param("username") String username);

    @Select("select * from emp where username = #{username} and password = #{password} limit 1")
    Emp findByNameAndPassword(@Param("username") String username, @Param("password") String password);
    
    @Select("select * from emp where id = #{id} limit 1")
    Emp findById(Integer id);
}
